package org.example.doctorapi.controller;

import lombok.extern.log4j.Log4j2;
import org.example.doctorapi.data.SysLoginInfo;
import org.example.doctorapi.server.SysLoginInfoServer;
import org.example.doctorcommon.util.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Log4j2
@RestController
@RequestMapping("/system/loginInfo")
public class LoginInfoController {
    @Autowired
    private SysLoginInfoServer sysLoginInfoServer;

    @PostMapping("/listForPage")
    public BaseResult listForPage(SysLoginInfo sysLoginInfo){
        return BaseResult.ok(sysLoginInfoServer.listForPage(sysLoginInfo));
    }

    @DeleteMapping("/deleteAll")
    public BaseResult DeleteDictAll(List<Integer> ids){
        sysLoginInfoServer.deleteLoginInfoByIds(ids);
        return BaseResult.ok("删除成功");
    }

    @DeleteMapping("/clearLoginInfo")
    public BaseResult ClearAll(){
        sysLoginInfoServer.clearLoginInfo();
        return BaseResult.ok("清除成功");
    }
}
